IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SrvrInstncSchedJobStepMSSQL]') AND type in (N'U'))
BEGIN
     DROP TABLE [dbo].[SrvrInstncSchedJobStepMSSQL]
END
GO

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[SrvrInstncSchedJobStepMSSQL](
     [SrvrInstncId]                   [int]              NOT NULL,
     [SrvrInstncSchedJobId]           [int]              NOT NULL,
     [StepId]                         [int]              NOT NULL,
     [StartDt]                        [datetime]         NOT NULL,
     [EndDt]                          [datetime]         NOT NULL,
     [CurrentRecordFlag]              [tinyint]          NOT NULL CONSTRAINT [DF_SrvrInstncSchedJobStepMSSQL_CurrentRecordFlag] DEFAULT ((0)),
     [PackageExecutionId]             [bigint]           NOT NULL,
     [StepDeletedFlag]                [tinyint]          NOT NULL CONSTRAINT [DF_SrvrInstncSchedJobStepMSSQL_StepDeletedFlag] DEFAULT ((0)),
     [StepIdentifier]                 [uniqueidentifier] NOT NULL,
     [StepName]                       [varchar](128)     NOT NULL,
     [SubSystem]                      [varchar](40)      NOT NULL,
     [Command]                        [nvarchar](max)    NOT NULL,
     [IncludeStepOutputInHistoryFlag] [tinyint]          NOT NULL,
     [LogToTableFlag]                 [tinyint]          NOT NULL,
     [LogToTableAppendOutputFlag]     [tinyint]          NOT NULL,
     [AppendOutputToOutputFileFlag]   [tinyint]          NOT NULL,
     [CmdExecSuccessCode]             [int]              NOT NULL,
     [OnSuccessAction]                [varchar](30)      NOT NULL,
     [OnFailAction]                   [varchar](30)      NOT NULL,
     [OnSuccessStepId]                [int]              NOT NULL,
     [OnFailStepId]                   [int]              NOT NULL,
     [ServerName]                     [varchar](128)         NULL,
     [DatabaseName]                   [varchar](128)         NULL,
     [DatabaseUserName]               [varchar](128)         NULL,
     [RetryAttempts]                  [int]              NOT NULL,
     [RetryIntervalInMinutes]         [int]              NOT NULL,
     [OSRunPriority]                  [int]              NOT NULL,
     [OutputFileName]                 [varchar](200)         NULL,
     [ProxyName]                      [varchar](128)         NULL,
     CONSTRAINT [PK_SrvrInstncSchedJobStepMSSQL] PRIMARY KEY CLUSTERED ( [SrvrInstncId] ASC, [SrvrInstncSchedJobId] ASC, [StepId] ASC, [StartDt] ASC )
) ON [PRIMARY]
GO

SET ANSI_PADDING OFF
GO
